package com.satoken.exception;

import cn.dev33.satoken.exception.DisableServiceException;
import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.util.SaResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(NotLoginException.class)
    public SaResult SaToKenException(NotLoginException e) {
        System.out.println("NotLoginException:" + e.getMessage());
        return SaResult.error("NotLoginException:" + e.getMessage());
    }

    @ExceptionHandler(DisableServiceException.class)
    public SaResult DisableServiceException(DisableServiceException e) {
        System.out.println("DisableServiceException:" + e.getMessage());
        return SaResult.error("DisableServiceException:" + e.getMessage());
    }
}
